<template>
	<view class="p30">
		<view class="mtb20">
			<u-steps current="3" activeColor="#06B7F3" inactiveColor="#C9D3E9">
				<u-steps-item title="信息输入">
				</u-steps-item>
				<u-steps-item title="车辆验证"></u-steps-item>
				<u-steps-item title="绑定成功"></u-steps-item>
			</u-steps>
		</view>
		<view class="pl30">
			<view class="flex-column-center mt60 mb90">
				<u-icon color="#19BE6B" size="60" name="checkmark-circle-fill"></u-icon>
				<view class="flex-row mt20">
					<view class=" c-desc">绑定成功，跳往</view>
					<view @click="onSuccess" class="c-primary" style="
					border-bottom: 1px solid #06B7F3;
					padding-bottom: 0px;">首页
					</view>
				</view>

			</view>
			<view class="flex-center-center mt100">
				<view style="width: 150px;">
					<u-button type="primary" text="立即认证" :throttleTime="1000" @click="verifyCarFun"></u-button>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		verifyCarAPI
	} from "@/api/api/car.js";
	import {
		throttle
	} from '@/utils/utils.js'
	
	export default {
		data() {
			return {
				carId: ''
			}
		},
		onLoad(params) {
			this.carId = params.id;
		},
		onShow() {
			this.$store.commit("setSpecialAppOnShow",false); 
		},
		methods: {
			onSuccess:throttle(function(){
				//设置当前车辆为默认车辆
				this.$store.commit("setIsToIndex",true);
				uni.reLaunch({
				  url: '/pages/views/home/index'
				})
			}),
			verifyCarFun() {
				this.$store.commit("setSpecialAppOnShow",true);
				verifyCarAPI(this.carId).then(([err, data]) => {
					if (err) return;
					let resData = JSON.parse(data);
					this.$store.commit("setVerifyUrl",resData.url)
					this.$reLaunch(`/pages/views/home/verify`)
				})
			}
		}
	}
</script>

<style>
</style>
